<?php
/**
 * @package WordPress
 * @subpackage Default_Theme
 */

// Do not delete these lines
	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');
?>

			<div id="comments">
<?php
	if ( post_password_required() ) { ?>
				<div class="nopassword"><?php _e( 'This post is protected. Enter the password to view any comments.', 'sandbox' ) ?></div>
			</div><!-- .comments -->
<?php
		return;
	}
?>

<!-- You can start editing here. -->

<?php if ( have_comments() ) : 
  $comment_args = comment_args();
?>



  <div id="comments-list" class="comments">
  	<h3><?php comments_number(__( 'Post a Comment', 'sandbox' ), __( '<span>One</span> Response', 'sandbox' ), __( '<span>%</span> Responses', 'sandbox' ) );?></h3>
	<div id="comment-nav-above" class="navigation">
		<div class="alignleft"><?php previous_comments_link() ?></div>
		<div class="alignright"><?php next_comments_link() ?></div>
	</div>

	<ol class="commentlist">
<?php wp_list_comments(array_merge($comment_args,array('callback' => 'custom_comments'))); ?>
	</ol>

	<div id="comment-nav-below" class="navigation">
		<div class="alignleft"><?php previous_comments_link() ?></div>
		<div class="alignright"><?php next_comments_link() ?></div>
	</div>
	
  </div>
 <?php else : // this is displayed if there are no comments so far ?>

	<?php if ('open' == $post->comment_status) : ?>
		<!-- If comments are open, but there are no comments. -->

	 <?php else : // comments are closed ?>
		<!-- If comments are closed. -->
		<p class="nocomments">Comments are closed.</p>

	<?php endif; ?>
<?php endif; ?>


<?php if ('open' == $post->comment_status) : ?>
<?php $req = get_option('require_name_email'); ?>

<div id="respond">

<h3><?php comment_form_title( __( 'Post a Comment', 'sandbox' ), __('Post a Comment to %s', 'sandbox') ); ?></h3>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
					<p id="login-req"><?php printf(__('You must be <a href="%s" title="Log in">logged in</a> to post a comment.', 'sandbox'),
					get_bloginfo('wpurl') . '/wp-login.php?redirect_to=' . get_permalink() ) ?></p>

<?php else : ?>
					<div class="formcontainer">	
						<form id="commentform" action="<?php bloginfo('wpurl') ?>/wp-comments-post.php" method="post">

<?php if ( $user_ID ) : ?>
							<p id="login"><?php printf( __( '<span class="loggedin">Logged in as <a href="%1$s" title="Logged in as %2$s">%2$s</a>.</span> <span class="logout"><a href="%3$s" title="Log out of this account">Log out?</a></span>', 'sandbox' ),
								get_bloginfo('wpurl') . '/wp-admin/profile.php',
								wp_specialchars( $user_identity, 1 ),
								get_bloginfo('wpurl') . '/wp-login.php?action=logout&amp;redirect_to=' . get_permalink() ) ?></p>

<?php else : ?>

							<p id="comment-notes"><?php _e( 'Your email is <em>never</em> shared.', 'sandbox' ) ?> <?php if ($req) _e( 'Required fields are marked <span class="required">*</span>', 'sandbox' ) ?></p>

							<div class="authorwrap"><label for="author"><?php _e( 'Name', 'sandbox' ) ?> <?php if ($req) _e( '<span class="required">*</span>', 'sandbox' ) ?></label><input id="author" name="author" class="text<?php if ($req) echo ' required'; ?>" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="50" tabindex="3" /></div>

							<div class="emailwrap"><label for="email"><?php _e( 'Email', 'sandbox' ) ?> <?php if ($req) _e( '<span class="required">*</span>', 'sandbox' ) ?></label><input id="email" name="email" class="text<?php if ($req) echo ' required'; ?>" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="4" /></div>

							<div class="urlwrap"><label for="url"><?php _e( 'Website', 'sandbox' ) ?></label><input id="url" name="url" class="text" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" /></div>

<?php endif // REFERENCE: * if ( $user_ID ) ?>
<!--<p><small><?php _e('You can use these <strong>XHTML</strong> tags: ', 'sandbox') ?><code><?php echo allowed_tags(); ?></code></small></p>-->
							<div class="textarea"><label for="comment"><?php _e( 'Comment', 'sandbox' ) ?></label><textarea id="comment" name="comment" class="text required" cols="45" rows="8" tabindex="6"></textarea></div>
							
							<div class="form-submit"><input id="submit" name="submit" class="button" type="submit" value="<?php _e( 'Post Comment', 'sandbox' ) ?>" tabindex="7" /></div>

							<div class="cancel-comment-reply"><small><?php cancel_comment_reply_link(__('Click here to cancel reply.','sandbox')); ?></small></div>

							<div class="form-option"><?php comment_id_fields(); ?>
<?php do_action( 'comment_form', $post->ID ) ?></div>

						</form><!-- #commentform -->
					</div><!-- .formcontainer -->

<?php endif // REFERENCE: if ( get_option('comment_registration') && !$user_ID ) ?>

				</div><!-- #respond -->
<?php endif // REFERENCE: if ( 'open' == $post->comment_status ) ?>

			</div><!-- #comments -->
